import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    showFlag: 1,
    headerAnimate: "",
    title: "",
    headerRightType: {
      val:99,
      txt:""
    },
    peopleList: false,
    loadingShow: true,
    userInfo: {},
    regionDataChecked: {
      id:[],
      text:"点击选择地域"
    },
    industryDataChecked: {
      id:[],
      text:"点击选择行业"
    },
    leaderAdvise:[],
    feedBackItemCheck:[],
    feedBackItemCheckSafe:[],
    feedBackItemDw:[],
    downsSet:false,
    manufacturers:false,
    showControl:false,
    orgChecked:{
      txt:"点击选择响应单位",
      val:[]
    },
    dwChecked:{
      txt:"点击选择协调处置机构或厂商",
      val:[]
    },
    jqChecked:{
      txt:"点击选择下发单位",
      val:[]
    },
    zjChecked:{
      txt:"点击选择研判专家",
      val:[]
    },
    routerAn:"slideRight",
  },
  mutations: {
    _showFlag(state, val){
      state.showFlag = val;
    },
    _headerAnimate(state, val){
      state.headerAnimate = val;
    },
    _title(state, val){
      state.title = val;
    },
    _headerRightType(state, val){
      state.headerRightType = val;
    },
    _peopleList(state, val){
      state.peopleList = val;
    },
    _loadingShow(state, val){
      state.loadingShow = val;
    },
    _regionDataChecked(state, val){
      state.regionDataChecked = val;
    },
    _industryDataChecked(state, val){
      state.industryDataChecked = val;
    },
    _leaderAdvise(state, val){
      state.leaderAdvise = val;
    },
    _showControl(state, val){
      state.showControl = val;
    },
    _orgChecked(state, val){
      state.orgChecked = val;
    },
    _dwChecked(state, val){
      state.dwChecked = val;
    },
    _jqChecked(state, val){
      state.jqChecked = val;
    },
    _zjChecked(state, val){
      state.zjChecked = val;
    },
    _feedBackItemCheck(state, val){
      state.feedBackItemCheck = val;
    },
    _feedBackItemCheckSafe(state, val){
      state.feedBackItemCheckSafe = val;
    },
    _routerAn(state, val){
      state.routerAn = val;
    },
    _userInfo(state, val){
      state.userInfo = val;
    },
    _downsSet(state, val){
      state.downsSet = val;
    },
    _manufacturers(state, val){
      state.manufacturers = val;
    },
  },
  getters: {
    showFlag_get(state){
      return state.showFlag;
    },
    headerAnimate_get(state){
      return state.headerAnimate;
    }
  },
  actions: {
    showFlag_action(context, val){
      let t = _methods.getHeader.init(val);
      context.commit("_title",t);
      context.commit("_showFlag", val);
    },
    headerAnimate_action(context, val){
      if (val) {
        context.commit("_headerAnimate", "header-back");
      } else {
        context.commit("_headerAnimate", "header-forward");
      }
      setTimeout(() => {
        context.commit("_headerAnimate", "");
      }, 500);
    },
  }
})
